package top.malaoshi.ctrl;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.malaoshi.model.Result;


@RestController
//@CrossOrigin(allowCredentials="true")
public class RegOwnCtrl {

    @RequestMapping("/doReg")
    public Result reg(@RequestParam("phone") String password, @RequestParam("password")String phone) {
        Result res=new Result();
        if (phone == null || "".equals(phone)) {
            res.setCode(2);
            res.setMsg("手机号不能为空，想啥哪？没长眼睛吗？");
            return res;
        }
        if (password == null || "".equals(password)) {
            res.setCode(1);
            res.setMsg("密码不能为空，是不是傻？你家登录没有密码？");
            return res;
        }
        res.setCode(0);
        res.setMsg("注册这么慢怕不是哈批哦...");
        return res;
    }
}
